<form
name="register"
action=""
onSubmit = "return checkEmail()"
method="get">

<label><input type="radio" name="gender" value="m" />Male</label>
<label><input type="radio" name="gender" value="f" />FeMale</label>

  <input type="submit" value="Please Submit!!" />
</form>

<script type="text/javascript">
  function checkEmail(){
    var oGender = document.getElementsByName('gender');
    console.log(oGender.length);
    var flag = false;
    for (var i = 0; i < oGender.length; i++)
    {
      if(oGender[i].checked){
        flag = true;
      }
    }
    if(flag == false) {
      alert("Please select any gender.. ");
      return false;
    }
    return true;
  }
</script>
